const fs = require('fs')


const readFile = function(path){
    return new Promise((resolve,reject)=> {
        fs.readFile(path,function(err,data){
            if(err) {
                reject(err)
            }else {
                resolve(data)
            }
        })
    })
}

const writeFile = function (path,content) {
    return new Promise((resolve,reject)=> {
        fs.writeFile(path,content,(err)=>{
            if(err) {
                reject(err)
            }else {
                resolve()
            }
        })
    })
}
module.exports = {
    writeFile,
    readFile
}